#include "../logsys/log.hpp"

void test()
{
    XKL::Logger::ptr logger = XKL::LoggerManager::GetInstance().GetLogger("sync-logger");
    ROOT_INFO("测试开始");
    logger->debug("日志测试");
    logger->info("%s", "日志测试");
    logger->warn("%s", "日志测试");
    logger->error("%s", "日志测试");
    logger->fatal("%s", "日志测试");
    ROOT_INFO("测试结束");
}

int main()
{
    std::unique_ptr<XKL::LoggerBuilder> builder(new XKL::GlobalLoggerBuilder());
    builder->BuildLoggerLevel(XKL::LogLevel::DEBUG);
    builder->BuildLoggerName("sync-logger");
    builder->BuildLoggerType(XKL::LoggerType::LOGGER_SYNC);
    builder->BuildFormater("[%d{%H:%M:%S}][%t][%c][%f:%l][%p]%T%m%n");
    builder->BuildSink<XKL::StdoutSink>();
    builder->BuildSink<XKL::FileSink>("./logfile/test.log");
    builder->BuildSink<XKL::RollSink>("./logfile/test-", 1024 * 1024);
    builder->Build();
    
    test();

    return 0;
}